package com.atguigu.dao;

import com.atguigu.bean.TagInfo;
import com.atguigu.util.MySQLUtil;

import java.util.List;

public class TagInfoDAO {

    public static TagInfo getTagInfo(String taskId){

        String sql = "select * from tag_info where tag_task_id='" + taskId + "'";

        TagInfo tagInfo = MySQLUtil.queryOne(sql, TagInfo.class, true);

        return tagInfo;

    }

    //查询所有已启用的标签明细
    public static List<TagInfo> getTagInfoWithOn(){

        String sql = "SELECT * FROM tag_info tg JOIN task_info tk ON  tg.`tag_task_id`=tk.id WHERE tk.`task_status`=1";

        List<TagInfo> tagInfoList = MySQLUtil.queryList(sql, TagInfo.class, true);

        return tagInfoList;
    }

}
